import { Select } from 'antd'
import React, { useState, useEffect } from 'react'

const termOptionsData = [
  { label: '重点排污', value: '重点排污', type: 'term' },
  { label: '环境统计', value: '环境统计', type: 'term' },
  { label: '在线检测', value: '在线检测', type: 'term' },
  { label: '重点行业类型', value: '重点行业类型', type: 'term' },
  { label: '其他行业类型', value: '其他行业类型', type: 'term' },
  { label: '管控类型', value: '管控类型', type: 'term' },
  { label: '全部', value: '', type: 'term' }
]

const SelectTerm = ({ change }) => {
  const [options, setOptions] = useState([])

  const handleChange = (value) => {
    console.log(`selected ${value}`)

    if (change) {
      change(value)
    }
  }

  useEffect(() => {
    setOptions(termOptionsData)
  }, [])
  return (
    <div className="Filter-item">
      <span>可选项列</span>
      <Select
        mode="tags"
        style={{
          width: '100%'
        }}
        placeholder="Tags Mode"
        onChange={handleChange}
        options={options}
      />
    </div>
  )
}

export default SelectTerm
